Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme: Write guide to resize guest fs #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rodrigobdz
Copy link

Add documentation on how-to resize guest filesystem to help users. There are a couple of additional steps involved after installing vagrant-disksize which are not straightforward.

Add documentation on how-to resize guest filesystem to help users.
@noaho
Copy link

noaho commented Jun 24, 2019

These are the commands I used in my Vagrantfile for bento/ubuntu-18.04

#Extend Volume to take up free space
$resizescript = <<-SCRIPT
parted /dev/sda resizepart 1 100%
pvresize /dev/sda1
lvextend -r -l +100%FREE /dev/vagrant-vg/root
SCRIPT
config.vm.provision :shell, inline: $resizescript

@blissdev
Copy link

Unfortunately these instructions don't seem to work RHEL-based systems such as Fedora.

@rodrigobdz
Copy link
Author

@blissdev Did you get an error? Please attach anything which could be useful identifying the problem

@p0rkjello
Copy link

I have a CentOS 7.7 box. The 8GB drive have been resized to 100GB using this plugin. I cannot figure out how to resize or even see the additional space. Could you recommend a solution?

[vagrant@habitat ~]$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                1s3rZJ-khqL-pvYz-sRud-GPZR-XXON-QsMI6H
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-10-17 17:18:33 +0000
  LV Status              available
  # open                 2
  LV Size                800.00 MiB
  Current LE             200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                dBzlWq-g9TK-YKvE-QS53-rhz8-BDzz-Hb3chv
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-10-17 17:18:33 +0000
  LV Status              available
  # open                 1
  LV Size                <6.03 GiB
  Current LE             1543
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

[vagrant@habitat ~]$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               6.81 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1743
  Free PE               0
  Allocated PE          1743
  PV UUID               9oXjBX-43kf-qTl6-Nmyg-gq3J-eKu0-b2r2GE

@pedrofurtado
Copy link

For CentOS 7/8: #39

@rodrigobdz
Copy link
Author

@sprotheroe Could you review this PR?

@clbarnes
Copy link

For reference, this is also discussed in #37 . The snippet posted by @noaho has worked for me in the past but does not after bumping the ubuntu version of my box.

@rodrigobdz
Copy link
Author

rodrigobdz commented May 19, 2021

@clbarnes Thanks for linking the issue.
Regarding the snippet, it probably doesn't work anymore because the device partition number (/dev/sda1) is different. Please verify.

Ideally, the device partition selection should be done automatically in the script.

@clbarnes
Copy link

clbarnes commented May 19, 2021

I tried with ubuntu/bionic64 (same ubuntu version, just a different provider). I provisioned without a disk resize, then SSH'd in, but according to df, /dev/sda1 is still the only device partition number. fdisk --list reports a partition /dev/sda1 and a disk /dev/sdb (10MiB)

However, despite failing, df, fdisk, and lsblk do report the desired size rather than the default size. Does this suggest it may not need the pvresize/lvresize?

@rodrigobdz
Copy link
Author

rodrigobdz commented May 19, 2021

Hard to say but here's a checklist to verify correct resizing.

Verify actual size of:

  • logical volume
  • physical volume
  • device partition
  • file system

@clbarnes
Copy link

clbarnes commented May 19, 2021

It seems the way to look at logical volumes, physical volumes, and volume groups is through the (lv|pv|vg)(s|display|scan) commands. I get no output from any of them (as root), even with the --all flag. Is it possible LVM is just being sidestepped entirely?

I tried to fallocate a file larger than the original disk space, and it succeeded. Doing that with a file larger than the desired disk space (aka the disk space reported by df/fdisk/lsblk) failed. I would take this to mean that resizing volumes and partitions is not necessary with ubuntu/* boxes or recent bento/ubuntu-* boxes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants